import request from '../utils/request'

export const listTags = () => {
	return request({
		url: '/tags',
		method: 'GET',
	})
}

export const searchTags = (keyword) => {
	return request({
		url: `/tags?keyword=${keyword}`,
		method: 'GET',
	})
}

export const listHotTags = () => {
	return request({
		url: `/tags/hot`,
		method: 'GET',
	})
}

export const insertTag = (tag) => {
	return request({
		url: '/tags',
		method: 'POST',
		data: tag,
	})
}

export const updateTag = (tagId, tag) => {
	return request({
		url: `/tags/${tagId}`,
		method: 'PATCH',
		data: tag,
	})
}

export const removeTag = (tagId) => {
	return request({
		url: `/tags/${tagId}`,
		method: 'DELETE',
	})
}
